import React from 'react';

import './index.less';

import {
    createPage,
    base
} from 'nc-lightapp-front';

import {render, connect} from '../../../../../hrpub/common/frame';

import OrgSituationAction from '../../actions/orgSituation';
import RowHandleAction from '../../actions/rowHandle';

const {
    NCModal,
    NCButton,
    NCSelect,
    NCTabs
} = base;

const {NCOption} = NCSelect;

const {NCTabPane} = NCTabs;

const {
    Header,
    Body,
    Footer
} = NCModal;

const Wrapper = render({
    actions: {
        orgSta: OrgSituationAction,
        rowAct: RowHandleAction
    },
    state: {
        // 临时存储
        selectedRows: null
    }
})(({props, state, action}) => {

    const {emp, editTable} = props;

    return (
        <NCModal
            show={emp.orgSituationModalVisible}
            size="lg"
            onHide={action.orgSta.closeModal}
            backdrop="static"
            onEntered={action.orgSta.setOrgDeptTableData}
        >
            <Header
                closeButton={true}
            >
                {emp.language['gx6008-000053']/** 编制情况 */}
            </Header>
            <Body>
                <div className="org-situation-modal-body">
                    <div className="org-dimension">
                        {emp.language['gx6008-000054']/** 编制维度 */}
                        <span className="org-dimension-select-wrapper">
                            <NCSelect
                                onChange={action.orgSta.changeOrgDimension}
                                value={emp.orgStaOrgDimension}
                                showClear={false}
                            >
                                {emp.orgStaOptions.map((item, index) => {
                                    return (
                                        <NCOption
                                            key={item.value}
                                        >
                                            {item.display}
                                        </NCOption>
                                    );
                                })}

                            </NCSelect>
                        </span>
                    </div>
                    <div>
                        <NCTabs
                            activeKey={emp.orgStaActiveTab}
                            onChange={action.orgSta.changeTab}
                        >
                            <NCTabPane
                                key="org"
                                tab={emp.language['gx6008-000055']/** "组织编制" */}
                            >
                                {editTable.createEditTable('org')}
                            </NCTabPane>
                            <NCTabPane
                                key="dept"
                                tab={emp.language['gx6008-000056']/** "部门编制" */}
                            >
                                {editTable.createEditTable('dept')}
                            </NCTabPane>
                        </NCTabs>
                    </div>
                </div>
            </Body>
        </NCModal>
    );

});


export default Wrapper;
